home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6833 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  682 b 

  1. Path: koobera.math.uic.edu!djb
  2. From: djb@koobera.math.uic.edu (D. J. Bernstein)
  3. Message-ID: <1996Feb1922.17.19.879@koobera.math.uic.edu>
  4. Date: 19 Feb 1996 22:17:19 GMT
  5. Newsgroups: comp.arch.arithmetic,comp.lang.c,comp.lang.c++
  6. Subject: Re: Access carry flag from C
  7. References: <Dn1C9z.DGv.0.net@indra.com>
  8. Organization: IR
  9.  
  10. Steve Sullivan <sullivan@indra.com> wrote:
  11. >    i = j + k;
  12. >    if (overflowed) ....;
  13.  
  14. A smart compiler will optimize ``if (i < j)''---I'm assuming here that
  15. all variables are unsigned---into a test of the carry bit.
  16.  
  17. (I've been saying for years that every compiler should provide a
  18. _documented_ idiom for every possible machine-language operation.)
  19.  
  20. ---Dan
  21.